package com.foosun.core.base;

import org.springframework.ui.Model;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by Nelin on 14-2-24.
 */
public interface BaseAction<T> {

    /**
     * 查询列表数据
     *
     * @param model
     * @return
     * @throws Exception
     */
    public String list(Model model, PageData<T> pageData, HttpServletRequest request) throws Exception;


    /**
     * 跳转新增表单
     *
     * @param model
     * @return
     */
    public String form(Model model) throws Exception;

    /**
     * 跳转新增表单
     *
     * @param model
     * @param id
     * @return
     * @throws Exception
     */
    public String edit(Model model, Integer id) throws Exception;

    /**
     * 保存数据
     *
     * @param model
     * @param entity
     * @return
     * @throws Exception
     */
    public String save(Model model, T entity) throws Exception;

    /**
     * 删除单条数据
     *
     * @param model
     * @param id
     * @return
     * @throws Exception
     */
    public String delete(Model model, Integer id) throws Exception;

    /**
     * 删除全部数据
     *
     * @param model
     * @return
     * @throws Exception
     */
    public String deleteAll(Model model) throws Exception;

}
